/**
 * lodash中的compose
 */
// flow 从左到右执行
// flowRight 从右到左执行

import { flowRight } from "lodash"

// 将数组最后一个元素转为大写
// toUpper(first(reverse(arr)))

const reverse = <T>(arr: T[]) => arr.reverse()
const first = <T>(arr: T[]) => arr[0]
const toUpper = (str: string) => str.toUpperCase()

const f = flowRight(toUpper, first, reverse)
console.log(f(['hello fp', 'hello compose', 'hello flowRight']))

export {}
